package com.jeequan.jeepay.mch.controller;

import com.jeequan.jeepay.core.entity.PaymentOrder;
import com.jeequan.jeepay.core.entity.PaymentUsdtOrder;
import com.jeequan.jeepay.core.entity.vo.CreateUsdtOrderVO;
import com.jeequan.jeepay.mch.ctrl.CommonCtrl;
import com.jeequan.jeepay.mch.service.PaymentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 代付订单表;(payment_order)表控制层
* @author : wondream322@gmail.com
* @date : 2023-8-19
*/
@Api(tags = "代付")
@RestController
@RequestMapping("/api/payment")
public class PaymentController extends CommonCtrl {
   @Autowired
   private PaymentService paymentService;

   /** 
    * 转账申请
    *
    * @param paymentOrder 实例对象
    * @return 实例对象
    */
   @ApiOperation("转账申请")
   @PostMapping("/createOrder")
   public ResponseEntity<PaymentOrder> createOrder(@RequestBody PaymentOrder paymentOrder){
       return ResponseEntity.ok(paymentService.createOrder(paymentOrder));
   }

    /**
     * 申请回U
     *
     * @param createUsdtOrderVO 实例对象
     * @return 实例对象
     */
    @ApiOperation("申请回U")
    @PostMapping("/createUsdtOrder")
    public ResponseEntity<PaymentUsdtOrder> createUsdtOrder(@RequestBody CreateUsdtOrderVO createUsdtOrderVO){
        return ResponseEntity.ok(paymentService.createUsdtOrder(createUsdtOrderVO));
    }

}